home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 June / EnigmA AMIGA RUN 19 (1997)(G.R. Edizioni)(IT)[!][issue 1997-06][EAR-CD III].iso / recent1 / apic1805.lha / APIC / examples / simple.asm < prev    next >
Assembly Source File  |  1997-05-10  |  728b  |  52 lines

  1. ;this is a simple source
  2. ;
  3. ;this little program toggles the PortA bit 3,
  4. ;Port B counts every change on bit RA.3
  5. ;
  6.  
  7.  
  8.  
  9.     list    p=PIC16C54, r=dec, s=off
  10.  
  11.  
  12.     org    1ffh
  13.     goto    start
  14.     org    0
  15.  
  16.  
  17.  
  18. count1    =    0Bh            ;this assigns the symbol to the register 
  19.  
  20. RA    =    5            ;PortA is register 5
  21. RB    =    6            ;PortB is register 6
  22.  
  23.  
  24.  
  25. start    movlw    00000111b    
  26.     tris    RA            ;bit 0 to bit 2 are inputs
  27.  
  28.     movlw    0            ;portb is output
  29.     tris    RB
  30.  
  31.     clrf    RB,f            ;clear PortB
  32.  
  33. main    movlw    00001000b
  34.     xorwf    RA            ;toggle bit 3 from PortA
  35.  
  36.     incf    RB,f            ;increase PortB
  37.  
  38.     call    delay
  39.  
  40.     goto    main            ;do the main loop
  41.  
  42.  
  43.  
  44.  
  45. delay    movlw    20
  46.     movwf    count1            ;mov 20 to count1
  47.  
  48. :loop    decfsz    count1
  49.     goto    :loop            ;decrement count1 and jump to local symbol until
  50.                     ;loop is > 0
  51.     retlw    0
  52.